'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ELF_GETARHDR 3ELF "Jul 11, 2001"
.SH NAME
elf_getarhdr \- retrieve archive member header
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lelf\fR [ \fIlibrary\fR... ]
#include <libelf.h>

\fBElf_Arhdr *\fR\fBelf_getarhdr\fR(\fBElf *\fR\fIelf\fR);
.fi

.SH DESCRIPTION
.sp
.LP
\fBelf_getarhdr()\fR returns a pointer to an archive member header, if one is
available for the \fBELF\fR descriptor \fIelf\fR. Otherwise, no archive member
header exists, an error occurred, or \fIelf\fR was null; \fBelf_getarhdr()\fR
then returns a null value. The header includes the following members.
.sp
.in +2
.nf
\fBchar	*ar_name;
time_t	ar_date;
uid_t	ar_uid;
gid_t	ar_gid;
mode_t	ar_mode;
off_t	ar_size;
char	*ar_rawname;\fR
.fi
.in -2

.sp
.LP
An archive member name, available through \fBar_name\fR, is a null-terminated
string, with the \fBar\fR format control characters removed. The
\fBar_rawname\fR member holds a null-terminated string that represents the
original name bytes in the file, including the terminating slash and trailing
blanks as specified in the archive format.
.sp
.LP
In addition to ``regular'' archive members, the archive format defines some
special members. All special member names begin with a slash (\fB/\fR),
distinguishing them from regular members (whose names may not contain a slash).
These special members have the names (\fBar_name\fR) defined below.
.sp
.ne 2
.na
\fB\fB/\fR\fR
.ad
.RS 6n
This is the archive symbol table. If present, it will be the first archive
member. A program may access the archive symbol table through
\fBelf_getarsym()\fR. The information in the symbol table is useful for random
archive processing (see \fBelf_rand()\fR on \fBelf_begin\fR(3ELF)).
.RE

.sp
.ne 2
.na
\fB\fB//\fR\fR
.ad
.RS 6n
This member, if present, holds a string table for long archive member names. An
archive member's header contains a 16-byte area for the name, which may be
exceeded in some file systems. The library automatically retrieves long member
names from the string table, setting \fBar_name\fR to the appropriate value.
.RE

.sp
.LP
Under some error conditions, a member's name might not be available. Although
this causes the library to set \fBar_name\fR to a null pointer, the
\fBar_rawname\fR member will be set as usual.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Stable
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR elf (3ELF),
.BR elf_begin (3ELF),
.BR elf_getarsym (3ELF),
.BR ar.h (3HEAD),
.BR libelf (3LIB),
.BR attributes (7)
